import request from '@/utils/request'
import { httpAxios } from '../utils/request';
let ProductApi = {

  /*分类管理*/
  catList(data, errorback) {
    return request._post('/shop/product/category/index', data, errorback);
  },
  /*分类添加*/
  catAdd(data, errorback) {
    return request._postBody('/shop/product/category/add', data, errorback);
  },
  /*分类删除*/
  catDel(data, errorback) {
    return request._post('/shop/product/category/delete', data, errorback);
  },
  /*分类修改*/
  catEdit(data, errorback) {
    return request._postBody('/shop/product/category/edit', data, errorback);
  },
  /*产品列表*/
  productList(data, errorback) {
    return request._postBody('/shop/product/product/index', data, errorback);
  },
  /*产品选择列表*/
  chooseLists(data, errorback) {
    //return request._postBody('/shop/product/product/index', data, errorback);
    return request._postBody('/shop/data/product/lists', data, errorback);
  },
  /*规格选择列表*/
  chooseSpec(data, errorback) {
    return request._post('/shop/data/product/spec', data, errorback);
  },
  /*新增产品*/
  addProduct(data, errorback) {
    return request._postBody('/shop/product/product/add', data, errorback);
  },
  /*产品基础数据*/
  getBaseData(data, errorback) {
    return request._get('/shop/product/product/toAdd', data, errorback);
  },
  /*删除产品*/
  delProduct(data, errorback) {
    return request._post('/shop/product/product/delete', data, errorback);
  },
  /*产品基础数据*/
  getEditData(data, errorback) {
    return request._get('/shop/product/product/edit', data, errorback);
  },
  /*新增产品*/
  editProduct(data, errorback) {
    return request._postBody('/shop/product/product/edit', data, errorback);
  },
  /*新增规格组*/
  addSpec(data, errorback) {
    return request._post('/shop/product/spec/addSpec', data, errorback);
  },
  /*新增规格值*/
  addSpecValue(data, errorback) {
    return request._post('/shop/product/spec/addSpecValue', data, errorback);
  },
  /*商品列表不带分页*/
  getList(data, errorback) {
    return request._post('/shop/data/product/lists', data, errorback);
  },
  /*商品列表不带分页*/
  getActiveProductList(data, errorback) {
    return request._post('/shop/plus.fans.product/lists', data, errorback);
  },
  /*商品评论列表*/
  getCommentList(data, errorback) {
    return request._postBody('/shop/product/comment/index', data, errorback);
  },
  /*获取评论详情*/
  getComment(data, errorback) {
    return request._post('/shop/product/comment/detail', data, errorback);
  },
  /*获取评论详情*/
  editComment(data, errorback) {
    return request._postBody('/shop/product/comment/edit', data, errorback);
  },
  /*删除评论*/
  delComment(data, errorback) {
    return request._post('/shop/product/comment/delete', data, errorback);
  },
  /*得到分类图片*/
  cateImage(data, errorback) {
    return request._post('/shop/product.category/image', data, errorback);
  },
  /*修改状态*/
  changeStatus(data, errorback) {
    return request._post('/shop/product/product/state', data, errorback);
  },
  setStatus(data, errorback) {
    return request._post('/shop/product/category/set', data, errorback);
  },
  exportProduct(data, errorback) {
    return httpAxios({
      url: '/shop/product/product/export',
      method: 'post',
      responseType: 'blob'
    })
  },

  commentExport(data) {
    return httpAxios({
      url: '/shop/product/comment/export',
      method: 'post',
      params: data,
      responseType: 'blob'
    })
  },

  batchImportProduct(data, errorback) {
    return request._upload('/shop/product/product/batchImportProduct', data, errorback);
  },
  // 发货详情
  toDelivery(data, errorback) {
    return request._get('/shop/order/order/toDelivery', data, errorback);
  },
  // 获取规格
  skuList(data, errorback) {
    return request._get('/shop/product/product/sku/list', data, errorback);
  },
  // 发货提交
  deliveryV2(data, errorback) {
    return request._postBody('/shop/order/order/delivery/v2', data, errorback);
  },
  // 发货列表-新增先选择订单接口
  orderList(data, errorback) {
    return request._get('/shop/order/order/list', data, errorback);
  },
  // 发货修改数量计算金额
  deliveryCalc(data, errorback) {
    return request._postBody('/shop/order/order/delivery/calc', data, errorback);
  },
  // 发货单列表
  deliveryPage(data, errorback) {
    return request._postBody('/shop/order/delivery/page', data, errorback);
  },
  // 发货审核
  deliveryDetail(data, errorback) {
    return request._postBody('/shop/order/delivery/detail', data, errorback);
  },
  // 发货审核
  deliveryAudit(data, errorback) {
    return request._postBody('/shop/order/delivery/audit', data, errorback);
  },
  // 小程序审核
  userAudit(data, errorback) {
    return request._postBody('/shop/user/user/audit', data, errorback);
  },
  // 取消发货单
  deliveryCancel(data, errorback) {
    return request._post('/shop/order/delivery/cancel', data, errorback);
  },
  // 关闭订单
  orderClose(data, errorback) {
    return request._post('/shop/order/order/close', data, errorback);
  },
  // 关闭修改记录订单
  billConfirm(data, errorback) {
    return request._postBody('/shop/order/order/bill/confirm', data, errorback);
  },
  // 修改发货
  deliveryUpdate(data, errorback) {
    return request._postBody('/shop/order/delivery/update', data, errorback);
  },

}

export default ProductApi;
